﻿
using System;
using System.Collections.Generic;
namespace Module12._1
{
    public delegate void Interest();
    public class Customers
    {

        /// <summary>
        /// Customer ID
        /// </summary>
        public int CustomerID;
        /// <summary>
        /// P for storing principal amount 
        /// </summary>
        public double P;
        /// <summary>
        /// R for storing rate of interest
        /// </summary>
        public double R;
        /// <summary>
        /// T for storing the time 
        /// </summary>
        public double T;
        /// <summary>
        /// I for inflation 
        /// </summary>
        public double I;
        /// <summary>
        /// N for storing the Number of Years 
        /// </summary>
        public int N;
        public void SimpleInterest()
        {
            Console.WriteLine("Simple Interest :" + P * N * R);
        }
        public void CompoundInterest()
        {
            Console.WriteLine("Compound Interest :" + P * N * R / 100);
        }
        public void RealInterest()
        {
            Console.WriteLine("Cho RealInterest ko bik tinh the nao. Dua dai 1 so vo day vay. :D ");
            Console.WriteLine("Real Interest :" + P * N * R / 2);
        }
        public void Accept()
        {
        L0:
            try
            {
                Console.Write("CustomerID  : ");
                CustomerID = Convert.ToInt32(Console.ReadLine());
                if (CustomerID <= 0)
                {
                    Console.WriteLine("CustomerID can not <= 0");
                    goto L0;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                goto L0;
            }
        L1:
            try
            {
                Console.Write("Principal amount: ");
                P = Convert.ToDouble(Console.ReadLine());
                if (P < 0)
                {
                    Console.WriteLine("Principal amount can not < 0");
                    goto L1;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                goto L1;
            }
        L2:
            try
            {
                Console.Write("Rate of interest: ");
                R = Convert.ToDouble(Console.ReadLine());
                if (R < 0)
                {
                    Console.WriteLine("Rate of interest can not < 0");
                    goto L2;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                goto L2;
            }
        L3:
            try
            {
                Console.Write("The time: ");
                T = Convert.ToDouble(Console.ReadLine());
                if (T < 0)
                {
                    Console.WriteLine("The time can not < 0");
                    goto L3;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                goto L3;
            }
        L4:
            try
            {
                Console.Write("Inflation : ");
                I = Convert.ToDouble(Console.ReadLine());
                if (I < 0)
                {
                    Console.WriteLine("Inflation can not < 0");
                    goto L4;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                goto L4;
            }
        L5:
            try
            {
                Console.Write("Number of Years  : ");
                N = Convert.ToInt32(Console.ReadLine());
                if (N < 0)
                {
                    Console.WriteLine("Number of Years can not < 0");
                    goto L5;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                goto L5;
            }
            Console.WriteLine("\n----------------------------------------------------- \n");
        }
    }
}
